package m.jclecai.com.view.klpk;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import m.jclecai.com.R;

/**
 * Created by andy on 2017/6/13.
 *这里是快乐扑克里面的一个自定义的toast;
 */
public class PokerToast {

    private final TextView mTvContent;
    Context mContext;
    private final Toast mToast;
    private final View mView;

    public PokerToast(Context context) {
        mContext = context;
        mView = View.inflate(context, R.layout.poker_toast, null);
        mTvContent = ((TextView) mView.findViewById(R.id.tv_content));
        mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
        mToast.setView(mView);
        mToast.setGravity(Gravity.CENTER,0,0);
    }

    public void show(){
        mToast.show();
    }

    public void showText(String str){
        mTvContent.setText(str);
        mToast.show();
    }
}
